3.176 \(\int \frac{(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx\)

Optimal. Leaf size=180 \[ -\frac{c g (1-2 p) \sin (e+f x) (g \sec (e+f x))^{p-1} \text{Hypergeometric2F1}\left (\frac{1}{2},\frac{1-p}{2},\frac{3-p}{2},\cos ^2(e+f x)\right )}{a f (1-p) \sqrt{\sin ^2(e+f x)}}+\frac{2 c \sin (e+f x) (g \sec (e+f x))^p \text{Hypergeometric2F1}\left (\frac{1}{2},-\frac{p}{2},\frac{2-p}{2},\cos ^2(e+f x)\right )}{a f \sqrt{\sin ^2(e+f x)}}-\frac{2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)} \]

[Out]

-((c*g*(1 - 2*p)*Hypergeometric2F1[1/2, (1 - p)/2, (3 - p)/2, Cos[e + f*x]^2]*(g*Sec[e + f*x])^(-1 + p)*Sin[e
+ f*x])/(a*f*(1 - p)*Sqrt[Sin[e + f*x]^2])) + (2*c*Hypergeometric2F1[1/2, -p/2, (2 - p)/2, Cos[e + f*x]^2]*(g*
Sec[e + f*x])^p*Sin[e + f*x])/(a*f*Sqrt[Sin[e + f*x]^2]) - (2*c*(g*Sec[e + f*x])^p*Tan[e + f*x])/(f*(a + a*Sec
[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.231625, antiderivative size = 180, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 4, integrand size = 34, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.118, Rules used = {4020, 3787, 3772, 2643} \[ -\frac{c g (1-2 p) \sin (e+f x) (g \sec (e+f x))^{p-1} \, _2F_1\left (\frac{1}{2},\frac{1-p}{2};\frac{3-p}{2};\cos ^2(e+f x)\right )}{a f (1-p) \sqrt{\sin ^2(e+f x)}}+\frac{2 c \sin (e+f x) (g \sec (e+f x))^p \, _2F_1\left (\frac{1}{2},-\frac{p}{2};\frac{2-p}{2};\cos ^2(e+f x)\right )}{a f \sqrt{\sin ^2(e+f x)}}-\frac{2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)} \]

Antiderivative was successfully verified.

[In]

Int[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x]

[Out]

-((c*g*(1 - 2*p)*Hypergeometric2F1[1/2, (1 - p)/2, (3 - p)/2, Cos[e + f*x]^2]*(g*Sec[e + f*x])^(-1 + p)*Sin[e
+ f*x])/(a*f*(1 - p)*Sqrt[Sin[e + f*x]^2])) + (2*c*Hypergeometric2F1[1/2, -p/2, (2 - p)/2, Cos[e + f*x]^2]*(g*
Sec[e + f*x])^p*Sin[e + f*x])/(a*f*Sqrt[Sin[e + f*x]^2]) - (2*c*(g*Sec[e + f*x])^p*Tan[e + f*x])/(f*(a + a*Sec
[e + f*x]))

Rule 4020

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*
(B_.) + (A_)), x_Symbol] :> -Simp[((A*b - a*B)*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^n)/(b*f*(2
*m + 1)), x] - Dist[1/(a^2*(2*m + 1)), Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n*Simp[b*B*n - a*A*(2
*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*
b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0]

Rule 3787

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[a, Int[(d*
Csc[e + f*x])^n, x], x] + Dist[b/d, Int[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]

Rule 3772

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 2643

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(Cos[c + d*x]*(b*Sin[c + d*x])^(n + 1)*Hypergeomet
ric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2])/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]), x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rubi steps

\begin{align*} \int \frac{(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx &=-\frac{2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac{\int (g \sec (e+f x))^p (a c (1-2 p)+2 a c p \sec (e+f x)) \, dx}{a^2}\\ &=-\frac{2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac{(c (1-2 p)) \int (g \sec (e+f x))^p \, dx}{a}+\frac{(2 c p) \int (g \sec (e+f x))^{1+p} \, dx}{a g}\\ &=-\frac{2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac{\left (c (1-2 p) \left (\frac{\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p\right ) \int \left (\frac{\cos (e+f x)}{g}\right )^{-p} \, dx}{a}+\frac{\left (2 c p \left (\frac{\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p\right ) \int \left (\frac{\cos (e+f x)}{g}\right )^{-1-p} \, dx}{a g}\\ &=-\frac{c (1-2 p) \cos (e+f x) \, _2F_1\left (\frac{1}{2},\frac{1-p}{2};\frac{3-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f (1-p) \sqrt{\sin ^2(e+f x)}}+\frac{2 c \, _2F_1\left (\frac{1}{2},-\frac{p}{2};\frac{2-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f \sqrt{\sin ^2(e+f x)}}-\frac{2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}\\ \end{align*}

Mathematica [C]  time = 17.3653, size = 3396, normalized size = 18.87 \[ \text{Result too large to show} \]

Warning: Unable to verify antiderivative.

[In]

Integrate[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x]

[Out]

(-6*c*Sec[e + f*x]^p*(g*Sec[e + f*x])^p*Tan[(e + f*x)/2]^3*(-((AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2
, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/
2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1
+ p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Ta
n[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] +
 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Ta
n[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)))/(a*f*(3*Sec[(e + f*x)/2]^2*Sec[e + f*x]^p*(-((Ap
pellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1
- p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e
 + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/
2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e +
f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + 6*
p*Sec[e + f*x]^(1 + p)*Sin[e + f*x]*Tan[(e + f*x)/2]*(-((AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan
[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]
+ 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1
 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e +
 f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(
AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e +
 f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + 6*Sec[e + f*x]^p*Tan[(e + f*x)/2]*((AppellF1[1/2, p,
1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]*Sin[(e + f*x)/2])/(3*AppellF1[1/2, p, 1
- p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e
 + f*x)/2]^2) - (Cos[(e + f*x)/2]^2*(-((1 - p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)
/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(
e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3))/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -T
an[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*App
ellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2) + ((p*AppellF1[3/2
, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (p*AppellF1
[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3)/(3*Appe
llF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*
x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e
 + f*x)/2]^2) - (AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*(2*p*(AppellF1[3/2, p, 1 -
 p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e
+ f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2] + 3*((p*AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Ta
n[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (p*AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2
, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3) + 2*p*Tan[(e + f*x)/2]^2*((-3*(1 - p)*AppellF1[
5/2, p, 2 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (6*p*App
ellF1[5/2, 1 + p, 1 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5
+ (3*(1 + p)*AppellF1[5/2, 2 + p, -p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e
+ f*x)/2])/5)))/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p,
1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[
(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)^2 + (AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2
]*Cos[(e + f*x)/2]^2*(2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*Ap
pellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2] +
 3*(-((1 - p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e
+ f*x)/2])/3 + (p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2
*Tan[(e + f*x)/2])/3) + 2*Tan[(e + f*x)/2]^2*((-1 + p)*((-3*(2 - p)*AppellF1[5/2, p, 3 - p, 7/2, Tan[(e + f*x)
/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (3*p*AppellF1[5/2, 1 + p, 2 - p, 7/2, Tan
[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5) + p*((-3*(1 - p)*AppellF1[5/2, 1
 + p, 2 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (3*(1 + p)
*AppellF1[5/2, 2 + p, 1 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2]
)/5))))/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p
, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2
, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)^2)))

________________________________________________________________________________________

Maple [F]  time = 0.897, size = 0, normalized size = 0. \begin{align*} \int{\frac{ \left ( g\sec \left ( fx+e \right ) \right ) ^{p} \left ( c-c\sec \left ( fx+e \right ) \right ) }{a+a\sec \left ( fx+e \right ) }}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

[Out]

int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} -\int \frac{{\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p}}{a \sec \left (f x + e\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="maxima")

[Out]

-integrate((c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (-\frac{{\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p}}{a \sec \left (f x + e\right ) + a}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="fricas")

[Out]

integral(-(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} - \frac{c \left (\int - \frac{\left (g \sec{\left (e + f x \right )}\right )^{p}}{\sec{\left (e + f x \right )} + 1}\, dx + \int \frac{\left (g \sec{\left (e + f x \right )}\right )^{p} \sec{\left (e + f x \right )}}{\sec{\left (e + f x \right )} + 1}\, dx\right )}{a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))**p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

[Out]

-c*(Integral(-(g*sec(e + f*x))**p/(sec(e + f*x) + 1), x) + Integral((g*sec(e + f*x))**p*sec(e + f*x)/(sec(e +
f*x) + 1), x))/a

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int -\frac{{\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p}}{a \sec \left (f x + e\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="giac")

[Out]

integrate(-(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)